<?php $this->load->view('line/layout/header')?>
<?php $this->load->view('line/layout/smallheader')?>
<div class="circuittest circuittest-order-ik">
  <ul class="circuittest-order-ul">
    <li>
      <div>订单号：</div>
      <div><?php echo $salesorder->order_sn;?></div>
    </li>
    <li>
      <div>订单状态：</div>
      <div><?php echo $lineOrderStatusArray[$salesorder->order_status];?></div>
    </li>
    <li>
      <div>付款状态：</div>
      <div><?php echo $lineOrderStateArray[$salesorder->order_state];?></div>
    </li>
    <li>
      <div>支付金额：</div>
      <div><i>¥</i>&nbsp;<?php echo $salesorder->order_pay_total;?></div>
    </li>
  </ul>
  <ul class="circuittest-order-ul circuittest-color-bai">
    <li>
      <h2><?php echo $orderProductInfo->line_name;?></h2>
    </li>
    <li>
      <div>供应商：</div>
      <div><?php echo !empty($orderProductInfo->alias_name) ? $orderProductInfo->alias_name : $orderProductInfo->user_name;?></div>
    </li>
    <li>
      <div>联系电话：</div>
      <div><?php echo !empty($orderProductInfo->cellphone) ? $orderProductInfo->cellphone : $orderProductInfo->telephone;?></div>
    </li>
  </ul>
  <ul class="circuittest-order-ul circuittest-color-bai circuittest-style-none">
    <li>
      <div>出行日期：</div>
      <div><?php echo date('Y-m-d',strtotime($orderProductInfo->start_date));?></div>
    </li>
    <li>
      <div>出行天数：</div>
      <div><?php echo $orderProductInfo->travel_days;?>天</div>
    </li>
    <li>
      <div>联系人：</div>
      <div><?php echo $salesorder->user_name;?></div>
    </li>
     <li>
      <div>联系电话：</div>
      <div><?php echo $salesorder->telephone;?></div>
    </li>
  </ul>
  <div class="circuittest-order-botton">
    <?php if($salesorder->order_state == 1 && ($salesorder->order_status == 1)):?>
        <a href="<?php echo site_url('line/lineorder/undoResellerOrder/'.$salesorder->order_id).'?order_status='.$this->input->get('order_status');?>"  onclick="return false" class="circuittest-order-alert">取消订单</a>
    <?php endif;?>
    <?php if ($salesorder->order_state == 1 && $salesorder->order_status == 2) :?>
        <?php if ($salesorder->pay_style_type != 2) : //如果是到付，则不显示。?>
           <a href="<?php echo site_url('line/payment/toPayOrderLine/'.$salesorder->order_sn)?>">去付款</a>
        <?php endif;?>
         <a href="<?php echo site_url('line/lineorder/undoResellerOrder/'.$salesorder->order_id).'?order_status='.$this->input->get('order_status');?>" onclick="return confirm('确定取消订单')">取消订单</a>
    <?php endif;?>
    <?php if ($salesorder->order_state == 2 && $salesorder->order_status == 4) :?>
        <?php $refund = $this->line_order_refund->validateResellerRefund($salesorder->order_id);?>
        
        <?php if (!$refund) :?>
            <a href="<?php echo site_url('line/lineorder/refundResellerOrder/'.$salesorder->order_id).'?order_status='.$this->input->get('order_status'); ?>">申请退款</a>
        <?php endif;?>
        
        <?php if ($refund && $refund->refund_status == 2) : ?>
            <a href="javacript:void(0)" onclick="return false" title="退款金额将会在7个工作日内退回">已同意退款</a>
        <?php elseif ($refund && $refund->refund_status == 3) :?>
            <a href="javacript:void(0)" onclick="return false" title="">已否决退款</a>
        <?php endif;?>
    <?php endif;?>
    <?php if ($salesorder->order_state == 4 && $salesorder->order_status == 6) :?>
        <a href="<?php echo site_url('line/lineorder/refundRefundDetail/'.$salesorder->order_id).'?order_status='.$this->input->get('order_status'); ?>">退款详情</a>
    <?php endif;?>
    <?php if ($salesorder->order_state == 3 && $salesorder->order_status == 5 && $this->line_product_reviews->validateProductReviews($salesorder->order_id, $orderProductInfo->line_id, $this->uid)) :?>
        <a href="<?php echo site_url('line/lineorder/showReview/'.$salesorder->order_id.'?order_status='.$salesorder->order_status); ?>">查看评价</a>
    <?php elseif ($salesorder->order_state == 2 && $salesorder->order_status == 5) :?>
            <?php $complain = $this->line_order_complain->validateResellerComplain($salesorder->order_id);?>
            <?php if ($complain && $complain->complain_status == 1) :?>
                <a target="_blank" href="<?php echo site_url('usercenter/providerOrder/resellerComplainDetail/'.$salesorder->order_id).'?order_status='.$this->input->get('order_status'); ?>">投诉详情</a>
            <?php elseif ($complain && $complain->complain_status == 2) :?>
                <a href="<?php echo site_url('usercenter/providerOrder/resellerAgreeComplain/'.$salesorder->order_id).'?order_status='.$this->input->get('order_status'); ?>" onclick="return confirm('确定要同意撤诉？')">同意撤诉</a>
                <a target="_blank" href="<?php echo site_url('usercenter/providerOrder/resellerComplainDetail/'.$salesorder->order_id).'?order_status='.$this->input->get('order_status'); ?>">投诉详情</a>
            <?php else :?>
                <?php if (time() > strtotime('+'.($orderProductInfo->travel_days).' day', strtotime($orderProductInfo->start_date))) :?>
                <a href="<?php echo site_url('line/lineorder/reviewProduct/'.$salesorder->order_id).'?order_status='.$this->input->get('order_status'); ?>">去评价</a>
                <?php endif;?>
                <?php if (!$complain) :?>
                <a href="<?php echo site_url('line/lineorder/resellerComplain/'.$salesorder->order_id).'?order_status='.$this->input->get('order_status'); ?>">投诉</a>
                <?php else : ?>
                <a target="_blank" href="<?php echo site_url('line/lineorder/resellerComplainDetail/'.$salesorder->order_id).'?order_status='.$this->input->get('order_status'); ?>">投诉详情</a>
                <?php endif;?>
            <?php endif;?>
    <?php endif;?>
  </div>
</div>
<?php $this->load->view('line/layout/footer')?>

<div class="am-modal am-modal-confirm" tabindex="-1" id="my-confirm">
  <div class="am-modal-dialog">
    <div class="am-modal-bd">
      你确定要取消订单吗？
    </div>
    <div class="am-modal-footer">
      <span class="am-modal-btn" data-am-modal-cancel>取消</span>
      <span class="am-modal-btn" data-am-modal-confirm>确定</span>
    </div>
  </div>
</div>
